<template>
    <view class="bg-content">

        <div style="background-color: white; padding: 15px 10px; border-bottom: 1px solid #eeeeee;"
             v-for="(tbCommunityDynamic, index) in tbCommunityDynamicList" :key="tbCommunityDynamic.id"
             @click="navigateTo(`/pages/sub/sub1-tabs/tabs/community-dynamic/community-dynamic-list/community-dynamic-detail/index`, null, tbCommunityDynamic)">
            <div style="display: flex;">
                <div style="width: 100%; font-size: 14px; padding-right: 10px;">
                    {{tbCommunityDynamic.title}}
                    <image src="/pages/sub/sub1-tabs/static/icon/new.png" style="padding-left: 5px; width: 16px; height: 16px; top: 3px;"
                           v-if="!tbCommunityDynamic.isRead"></image>
                </div>
                <div style="width: 110px; color: #909399; text-align: right;">{{tbCommunityDynamic.showTime}}</div>
            </div>
        </div>

        <div style="padding-top: 10px; padding-bottom: 10px;">
            <u-loadmore :status="pagination.status" bg-color="#eeeeee"/>
        </div>

    </view>
</template>

<script>

    import {TbCommunityDynamicService} from "@/dev/services/tb-community-dynamic.service";

    export default {
        data() {
            return {
                tbCommunityDynamicList: []
            }
        },
        onShow() {
            const _self = this;
            // 设置首页标题
            uni.setNavigationBarTitle({
                title: this.objParams.name
            });
            this.doRefresh(this.tbCommunityDynamicList);
        },
        methods: {
            /**
             * 加载更多数据中
             * @param infiniteScroll
             */
            doInfinite(infiniteScroll) {
                const _self = this;
                new TbCommunityDynamicService().findTableTbCommunityDynamicList({
                    pagination: _self.pagination,
                    data: {
                        communityId: _self.globalVariable.userInfo.tbCommunity.id,
                        communityDynamicTypeId: _self.objParams.id,
                        isPublish: true,
                        status: '1',
                        deleted: 0,
                        orderBy: 'create_time desc'
                    },
                }).then(result => {
                    _self.pagination.refreshPage(result);
                    _self.tbCommunityDynamicList = [..._self.tbCommunityDynamicList, ...result.list];
                });
            }
        }
    }
</script>

<style lang="scss" scoped>
</style>
